package com.asset.dispoal.dataDetail;

import com.asset.dispoal.dataDetail.api.SysDataDetailService;
import com.asset.dispoal.dataDetail.dto.SysDataDetailRequest;
import com.asset.dispoal.dataDetail.dto.SysDataDetailResponse;
import com.asset.dispoal.dataDetail.dto.SysDataDetailTemplateRequest;
import com.asset.dispoal.dataDetail.dto.SysDataDetailTemplateResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import tech.mhuang.pacebox.springboot.protocol.Result;
import tech.mhuang.pacebox.springboot.protocol.data.PageVO;

/**
 * @author qr
 * @date 2022/3/23$
 */

@RestController
@Api(value = "数据清单", tags = "数据清单")
@RequestMapping("system/dataDetail")
public class DataDetailController {

    @Autowired
    SysDataDetailService sysDataDetailService;

    @PostMapping("insert")
    @ApiOperation(value = "初始化", notes = "初始化")
    public Result insert(@RequestBody SysDataDetailRequest sysDataDetailRequest) {
        sysDataDetailService.insert(sysDataDetailRequest);
        return Result.ok();
    }


    @PostMapping("update")
    @ApiOperation(value = "修改", notes = "修改")
    public Result update(@RequestBody SysDataDetailRequest sysDataDetailRequest) {
        sysDataDetailService.update(sysDataDetailRequest);
        return Result.ok();
    }

    @PostMapping("delete")
    @ApiOperation(value = "修改", notes = "修改")
    public Result delete(@RequestBody String id) {
        sysDataDetailService.delete(id);
        return Result.ok();
    }

    @GetMapping("/queryTemplatePage")
    @ApiOperation(value = "查询模板")
    public Result<PageVO<SysDataDetailTemplateResponse>> queryTemplatePage(SysDataDetailTemplateRequest request) {
        return sysDataDetailService.queryTemplatePage(request);
    }

    @GetMapping("queryPage")
    @ApiOperation(value = "查询", notes = "查询")
    public Result<PageVO<SysDataDetailResponse>> queryPage(SysDataDetailRequest sysDataDetailRequest) {
        return sysDataDetailService.queryPage(sysDataDetailRequest);
    }


}
